<%@ taglib prefix="s" uri="/struts-tags" %>

  <jsp:include page="/pages/header.jsp" flush="true"/>
   
	<s:if test="reviews.size() > 0">
		<div class="content">
			<table class="personTable" cellpadding="10px">
				<tr class="even">
					<th>ID</th>
					<th>Date</th>
					<th>Category</th>
					<th>Moderator</th>
					<th>Authors</th>
					<th>Revisors</th>
					<th>RevisorsQ</th>
					<th>Add</th>
					<th>Close</th>
				</tr>
				<s:iterator value="reviews" status="reviewStatus">
				
				<s:if test="recommendedRevisorsQ != -1">
				
					<tr class="<s:if test="#reviewStatus.odd == true ">odd</s:if><s:else>even</s:else>">
						<td><s:property value="id"/></td>
						
						<s:set name="currReviewId" value="id"></s:set>
						
						<td><s:property value="date" /></td>
						<td><s:property value="category.name" /></td>
						<td>
						<s:if test="mod != null">
							<s:property value="mod.name" />
						</s:if>
						</td>
						
						<td>
							<s:if test="authors != null && authors.size() > 0">
								<s:iterator value="authors" status="authorStatus">
									<s:property value="name" />
									<s:if test="#authorStatus!=1 && #authorStatus!=authors.size()">,</s:if>
								</s:iterator>
							</s:if>
						</td>
						
						<td>

							<s:if test="revisors != null && revisors.size() > 0">
								<s:iterator value="revisors" status="revisorStatus">
								
									<s:url action="deleteRevisor" id="deleteRevisorURL" >
										<s:param name="selectedReview" value="currReviewId"></s:param>
										<s:param name="selectedRevisor"><s:property value="name" /></s:param>
									</s:url>
								
									<s:a href="%{deleteRevisorURL}"><s:property value="name" /></s:a>
									
									<s:if test="#revisorStatus!=1 && #revisorStatus!=revisors.size()">,</s:if>
								</s:iterator>
							</s:if>
						</td>
						
						<td><s:property value="recommendedRevisorsQ" /></td>
						
						<s:url action="populateReview" id="populateReviewURLMod" >
							<s:param name="selectedReview" value="id"></s:param>
							<s:param name="addtype">mod</s:param>
						</s:url>
						
						<s:url action="populateReview" id="populateReviewURLAuthor" >
							<s:param name="selectedReview" value="id"></s:param>
							<s:param name="addtype">author</s:param>
						</s:url>
						
						<s:url action="populateReview" id="populateReviewURLRevisor" >
							<s:param name="selectedReview" value="id"></s:param>
							<s:param name="addtype">revisor</s:param>
						</s:url>

						<td>
							<s:a href="%{populateReviewURLMod}">Mod</s:a>
							<s:a href="%{populateReviewURLAuthor}">Author</s:a>
							<s:a href="%{populateReviewURLRevisor}">Revisor</s:a>
						</td>
						
						<s:url action="closeReview" id="closeReviewURL" >
							<s:param name="selectedReview" value="id"></s:param>
						</s:url>
						
						<td>
							<s:a href="%{closeReviewURL}">X</s:a>
						</td>
						
						</tr>
						</s:if>
				</s:iterator>
			</table>
		</div>
	</s:if>
	<s:else>
		<h1>No Reviews</h1>
	</s:else>
    
    
  <%="</body>"%>
<%="</html>"%>